#ifndef __CAR_H__
#define __CAR_H__

#include "BaseLayer.h"

class Car : public BaseLayer {
public:
	Car() : m_car(NULL), m_wheel1(NULL), 
		m_wheel2(NULL), m_spring1(NULL),
		m_spring2(NULL), m_mouseJoint(NULL),
		m_hz(4.0f), m_zeta(0.7f), m_speed(50.0f) {}
	~Car() {}
	static CCScene* scene();
	virtual bool init();
	CREATE_FUNC(Car);

public:
	virtual void initGround();
	void createCar();

public:
	void update(float delta);

public:
	virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
	virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
	virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);

private:
	b2Body* m_car;
	b2Body* m_wheel1;
	b2Body* m_wheel2;

	float32 m_hz;
	float32 m_zeta;
	float32 m_speed;
	b2WheelJoint* m_spring1;
	b2WheelJoint* m_spring2;

	b2MouseJoint* m_mouseJoint;
};

#endif // __CAR_H__